* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vm;
    background-color: #f2f2f2;
}

.navbar {
    position: relative;
    width: 100%;
    height: 50px;
    line-height: 50px;
    background-color: #fff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}

.navbar input {
    display: none;
}

.navbar label {
    position: absolute;
    top: 0;
    left: 200px;
    font-size: 20px;
    color: #666666;
    padding-left: 20px;
    cursor: pointer;
    /* 设置过渡 */
    transition: all .5s;
}

.navbar ul {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 100vh;
    background-color: #20222a;
    transition: all .5s;
}

.navbar ul li {
    width: 100%;
    height: 70px;
    margin-bottom: 10px;
}

.navbar ul li:first-child {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 10px;
    width: 100%;
    height: 150px;
}

.navbar ul li:first-child img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.navbar ul li:first-child span {
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
}

.navbar ul li a {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    color: #d2d2d2;
    text-decoration: none;
    border-left: 6px solid transparent;
}

.navbar ul li a i {
    font-size: 18px;
    margin: 0 15px;
}

.navbar ul li a span {
    font-size: 14px;
}

.navbar ul li a:hover {
    color: #fff;
    /* 这样文字和图标会被带跑不太好看，解决办法就是默认设置 a 标签有边框，但是是透明的 */
    /*border-left: 6px solid #fb7299;*/
    border-left-color: #fb7299;
}

.navbar input:checked + label {
    left: 0;
}

.navbar input:checked + label i {
    transform: rotateY(180deg);
}

.navbar input:checked ~ ul {
    left: -200px;
}
